<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta name="author" content="YZC">
	<meta name="copyright" content="YZC">
	<title>${message("admin.admin.edit")} - ${setting.siteName}</title>
	<link href="${base}/favicon.ico" rel="icon">
	<link href="${base}/resources/admin/css/bootstrap.css" rel="stylesheet">
	<link href="${base}/resources/admin/css/animate.css" rel="stylesheet">
	<link href="${base}/resources/admin/css/adminLTE.css" rel="stylesheet">
	<link href="${base}/resources/admin/css/common.css" rel="stylesheet">
	<!--[if lt IE 9]>
		<script src="${base}/resources/admin/js/html5shiv.js"></script>
		<script src="${base}/resources/admin/js/respond.js"></script>
	<![endif]-->
	<script src="${base}/resources/admin/js/jquery.js"></script>
	<script src="${base}/resources/admin/js/bootstrap.js"></script>
	<script src="${base}/resources/admin/js/icheck.js"></script>
	<script src="${base}/resources/admin/js/jquery.validate.js"></script>
	<script src="${base}/resources/admin/js/adminLTE.js"></script>
	<script src="${base}/resources/admin/js/common.js"></script>
	<script type="text/javascript">
	$().ready(function() {
	
		var $inputForm = $("#inputForm");
		
		[@flash_message /]
		
		// 表单验证
		$inputForm.validate({
			rules: {
				password: {
					minlength: 4
				},
				rePassword: {
					equalTo: "#password"
				},
				"admin.email": {
					required: true,
					email: true,
					remote: {
						url: "check_email?id=${admin.id}",
						cache: false
					}
				},
				roleIds: "required"
			},
			messages: {
				"admin.email": {
					remote: "${message("common.validate.exist")}"
				}
			}
		});
	
	});
	</script>
</head>
<body class="hold-transition sidebar-mini">
	<div class="container-fluid">
		<section class="content-header">
			<h1>${message("admin.admin.edit")}</h1>
			<ol class="breadcrumb">
				<li>
					<a href="${base}/admin/index" target="_top">
						<i class="fa fa-home"></i>
						${message("admin.common.index")}
					</a>
				</li>
				<li class="active">${message("admin.admin.edit")}</li>
			</ol>
		</section>
		<section class="content">
			<div class="row">
				<div class="col-xs-12">
					<form id="inputForm" class="form-horizontal" action="${base}/admin/admin/update" method="post">
						<input type="hidden" name="admin.id" value="${admin.id}" />
						<div class="box">
							<div class="box-body">
								<div class="form-group">
									<label class="col-xs-2 control-label item-required" for="username">${message("Admin.username")}:</label>
									<div class="col-xs-4">
										<input name="admin.username" class="form-control" type="text" maxlength="20" value="${admin.username}" readonly="readonly">
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label" for="name">${message("Admin.name")}:</label>
									<div class="col-xs-4">
										<input name="admin.name" class="form-control" type="text" maxlength="20" value="${admin.name}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label" for="department">${message("Admin.department")}:</label>
									<div class="col-xs-4">
										<input name="admin.department" class="form-control" type="text" maxlength="50" value="${admin.department}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label" for="password">${message("Admin.password")}:</label>
									<div class="col-xs-4">
										<input id="password" name="password" class="form-control" type="password" maxlength="20" autocomplete="off">
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label" for="rePassword">${message("admin.admin.rePassword")}:</label>
									<div class="col-xs-4">
										<input name="rePassword" class="form-control" type="password" maxlength="20" autocomplete="off">
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label item-required" for="email">${message("Admin.email")}:</label>
									<div class="col-xs-4">
										<input name="admin.email" class="form-control" type="text" maxlength="200" value="${admin.email}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label" for="roles">${message("Admin.roles")}:</label>
									<div class="col-xs-10">
										[#list roles as role]
											<label for="${role.id}" class="cbx-label">
												<input id="${role.id}" type="checkbox" name="roleIds" class="iCheckbox" value="${role.id}" [#if admin.roles?seq_contains(role)] checked="checked"[/#if] />
												${role.name}
											</label>&nbsp;&nbsp;
										[/#list]
									</div>
								</div>
								<div class="form-group">
									<label class="col-xs-2 control-label" for="isEnabled">${message("admin.common.setting")}:</label>
									<div class="col-xs-4 checkbox">
										<input id="isEnabled" name="isEnabled" type="checkbox" checked="checked" value="true" [#if admin.isEnabled] checked="checked"[/#if] class="iCheckbox">
										<label for="isEnabled" class="cbx-label">${message("Admin.is_enabled")}</label>
										[#if admin.isLocked]
											<label>
												<input type="checkbox" name="unlock" value="true" class="iCheckbox" />${message("admin.admin.unlock")}
											</label>
										[/#if]
									</div>
								</div>
							</div>
							<div class="box-footer">
								<div class="row">
									<div class="col-xs-4 col-xs-offset-2">
										<button class="btn btn-primary" type="submit">${message("admin.common.submit")}</button>
										<button class="btn btn-default" type="button" data-toggle="back">${message("admin.common.back")}</button>
									</div>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</section>
	</div>
</body>
</html>